package com.danco.training.zaneuskaya.controller.book;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.danco.training.zaneuskaya.api.BookService;
import com.danco.training.zaneuskaya.controller.GenericController;
import com.danco.training.zaneuskaya.service.impl.BookServiceImpl;

@SuppressWarnings("serial")
public class BookListController extends GenericController {


	private BookService bookService;

	
	public BookListController() {
		super();
		bookService = BookServiceImpl.getBookStorageSeviceImplInstance();

	}

	
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		
		req.setAttribute("books", bookService.getBooksSortedByAlphabet());
		req.getRequestDispatcher("/WEB-INF/views/book/list.jsp").forward(req, resp);

	}

}
